package com.ktgj.customer.mapper;

import java.util.List;
import com.ktgj.customer.domain.BusinessOrder;
import com.ktgj.customer.domain.dto.CustomerCardOrderDTO;
import com.ktgj.customer.domain.vo.CardSaleRecords;
import com.ktgj.customer.domain.vo.CustomerCardOrderListVO;
import com.ktgj.customer.domain.vo.PurchaseCardVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

/**
 * 订单Mapper接口
 * 
 * @author ruoyi
 * @date 2021-07-30
 */
@Repository
public interface BusinessOrderMapper 
{
    /**
     * 查询订单
     * 
     * @param orderId 订单ID
     * @return 订单
     */
    public BusinessOrder selectBusinessOrderById(Long orderId);

    /**
     * 根据卡订单表主键查找订单信息
     * @param orderId
     * @return
     */
    public BusinessOrder selectBusinessOrderByOrderId(Long orderId);

    /**
     * 查询订单列表
     * 
     * @param businessOrder 订单
     * @return 订单集合
     */
    public List<BusinessOrder> selectBusinessOrderList(BusinessOrder businessOrder);

    /**
     * 新增订单
     * 
     * @param businessOrder 订单
     * @return 结果
     */
    public int insertBusinessOrder(BusinessOrder businessOrder);

    /**
     * 修改订单
     * 
     * @param businessOrder 订单
     * @return 结果
     */
    public int updateBusinessOrder(BusinessOrder businessOrder);

    /**
     * 删除订单
     * 
     * @param orderId 订单ID
     * @return 结果
     */
    public int deleteBusinessOrderById(Long orderId);

    /**
     * 批量删除订单
     * 
     * @param orderIds 需要删除的数据ID
     * @return 结果
     */
    public int deleteBusinessOrderByIds(Long[] orderIds);

    public BusinessOrder selectBusinessOrderByNum(String orderNum);
    public List<BusinessOrder> selectBusinessOrderByRecord(@Param("customerId") Long customerId, @Param("cardId") Long cardId);

    List<BusinessOrder> selectbusinessorderByState();

    /**
     * 根据订单状态查询
     * */
    public List<BusinessOrder> selectBusinessOrderByOrderState(@Param("customerId") Long customerId,
                                                               @Param("orderState") String orderState);

    /**
     * 查询我的全部订单
     * */
    public List<BusinessOrder> selectBusinessOrderByCustomerIdAndOrderState(Long customerId);

    /**
     * 根据订单号查询会员Id(远程)
     * */
    public BusinessOrder selectBusinessOrderByOrdernum(String ordernum);

    int updateBillQRCode(@Param("orderNum") String orderNum, @Param("billQRCode") String billQRCode);

    String getBillQRCode(String orderNum);

    /**
     * 条件查询售卡数量
     * */
    public List<BusinessOrder> businessOrderList(@Param("employeeDeptid") Long employeeDeptid,
                                                 @Param("createTimeForward") String createTimeForward,
                                                 @Param("createTimeBack") String createTimeBack);

    /**
     * 获取指定部门售卡记录
     * */
    public List<BusinessOrder> businessOrderByDeptId(CardSaleRecords cardSaleRecords);

    /**
     * 会员购卡
     * */
    public List<PurchaseCardVo> orderList(Long customerId);

    BusinessOrder selectCustomerIdByCard(Long cardId);

    /**
     * 会员购卡订单列表
     * @param customerCardOrder
     * @return
     */
    public List<CustomerCardOrderListVO> customerCardOrderList(CustomerCardOrderDTO customerCardOrder);
}
